package com.maven.front.service.myPersonal;

import com.maven.front.bean.*;
import com.maven.front.mapper.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: web-front
 * @description: 前台个人中心
 * @author: WangYiLong
 * @create: 2020-08-08 14:54
 **/
@Service
public class MyPersonalService {

    @Resource
    private EduUserMapper eduUserMapper;

    @Resource
    private EduCourseMapper eduCourseMapper;

    @Resource
    private EduCourseStudyhistoryMapper eduCourseStudyhistoryMapper;

    @Resource
    private EduCourseKpointMapper eduCourseKpointMapper;

    @Resource
    private EduQuestionsMapper eduQuestionsMapper;

    @Resource
    private EduQuestionsCommentMapper eduQuestionsCommentMapper;

    /**
     *  个人资料修改
     * @param eduUser
     * @return
     */
    public int update(EduUser eduUser){
        return eduUserMapper.updateByPrimaryKeySelective(eduUser);
    }

    public List<EduCourse> getFreeCourse(){
        return eduCourseMapper.freeCourse();
    }

    public EduUser getById(Integer id){
        return eduUserMapper.selectByPrimaryKey(id);
    }

    public List<EduCourseKpoint> selectTotalTime(){
        return eduCourseKpointMapper.selectTotalTime();
    }

    public List<EduCourseStudyhistory> selectViewTimeByUserId(Integer userId){
        return eduCourseStudyhistoryMapper.selectViewTimeByUserId(userId);
    };

    public List<EduCourse> select(EduCourse eduCourse){
        return eduCourseMapper.select(eduCourse);
    };

    public List<EduQuestions> selectByCusId(Integer cusId){
        return eduQuestionsMapper.selectByCusId(cusId);
    };

    public List<EduQuestionsComment> getQuesstionsComment(Integer cusId){
        return eduQuestionsCommentMapper.selectByCusId(cusId);
    }

    public List<EduQuestions> selectByPrimaryKeys(List<EduQuestionsComment> list){
        return eduQuestionsMapper.selectByPrimaryKeys(list);
    }

    public List<EduUser> selectByUserIds(List<EduQuestions> list){
        return eduUserMapper.selectByUserIds(list);
    }
}
